include(CMakeForceCompiler)

# The Generic system name is used for embedded targets (targets without OS) in
# CMake
set( CMAKE_SYSTEM_NAME          Linux )
set( CMAKE_SYSTEM_PROCESSOR     aarch64 )
set( ARCH aarch64 )
SET ( CMAKE_C_COMPILER "/opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc" )
SET ( CMAKE_CXX_COMPILER "/opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++" )
SET ( CMAKE_FIND_ROOT_PATH "/opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu" )


# SET ( COMPILER_NAME jingshi-cv183)

message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")


option(USE_SDK_CMAKE "SDK_CMAKE support" ON)
option(USE_FFMPEG "FFMPEG support" ON)
option(CV_TPU "cv_ipu support" ON)
if(CV_TPU)
message(STATUS "cv_tpu")
add_definitions(-D__CV_TPU_183__)
endif()
SET(SDK_LIB_TYPE static)



SET(SDK_PATH thirdparty/jingshi/CV1838)

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


# We must set the OBJCOPY setting into cache so that it's available to the
# whole project. Otherwise, this does not get set into the CACHE and therefore
# the build doesn't know what the OBJCOPY filepath is
set(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy
	    CACHE FILEPATH "The toolchain objcopy command " FORCE )

# Set the CMAKE C flags (which should also be used by the assembler!

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -std=gnu11" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-to-int-cast" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3" )

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "" )
set( CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "" )
option(DECRYPT "DECRYPT support" ON)
option(USE_ADAS "ADAS support" ON)
option(USE_BSD "BSD support" OFF)

# set(COMPILER_NAME jingshi-cv183-aarch64-arm)
